package com.huawei.hms.framework.network.restclient.hwhttp.dns;

import android.text.TextUtils;
import com.huawei.hms.framework.common.Logger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

public interface RCDns {
    public static final RCDns DEFAULT = new RCDns() {
        public List<InetAddress> lookup(String str) throws UnknownHostException {
            if (TextUtils.isEmpty(str)) {
                throw new UnknownHostException("hostname == null");
            }
            List<InetAddress> list = null;
            try {
                list = DnsUtil.getIPListByHost(str);
            } catch (UnknownHostException e) {
                throw e;
            } catch (Throwable th) {
                Logger.e("RCDns", "may be error", th);
            }
            if (list == null || list.isEmpty()) {
                return DnsUtil.localDnsLookup(str);
            }
            return list;
        }

        public void setDnstime(int i) {
            DnsUtil.setDnstime(i);
        }
    };

    List<InetAddress> lookup(String str) throws UnknownHostException;

    void setDnstime(int i);
}
